// Vehicle class class Vehicle { private String brand; private int year; public Vehicle(String brand, int year) { this.brand = brand; this.year = year; } public String getBrand() { return brand; } public int getYear() { return year; } public void displayInfo() { System.out.println("Vehicle: " + brand + " - Year: " + year); } } // Car class extending Vehicle class Car extends Vehicle { private int numberOfDoors; public Car(String brand, int year, int numberOfDoors) { super(brand, year); this.numberOfDoors = numberOfDoors; } public int getNumberOfDoors() { return numberOfDoors; } @Override public void displayInfo() { super.displayInfo(); System.out.println("Number of doors: " + numberOfDoors); } } // Main class to instantiate and use the vehicle classes public class Main { public static void main(String[] args) { Vehicle vehicle1 = new Vehicle("Generic Vehicle", 2022); vehicle1.displayInfo(); Car car1 = new Car("Toyota", 2023, 4); car1.displayInfo(); } }